import config from "@renderer/config"
import http from "@renderer/utils/request"

export default {
  version: {
    url: `${config.API_URL}/version`,
    name: "获取最新版本号",
    get: async function(){
      return await http.get(this.url);
    }
  },
  //系统-机构管理
  unit: {
    list: {
      url: `${config.API_URL}/system/unit/list`,
      name: "获取机构树",
      get: async function (data) {
        return await http.get(this.url, data);
      }
    },
    tree: {
      url: `${config.API_URL}/system/unit/tree`,
      name: "获取机构树",
      get: async function (data) {
        return await http.get(this.url, data);
      }
    },
    addUnit: {
      url: `${config.API_URL}/system/unit/add`,
      name: "添加机构",
      post: async function (data) {
        return await http.post(this.url, data);
      }
    },
    delUnit: {
      url: `${config.API_URL}/system/unit/delete/`,
      name: "删除机构",
      get: async function (id) {
        return await http.get(`${this.url + id}`);
      }
    },
    updateUnit: {
      url: `${config.API_URL}/system/unit/update`,
      name: "更新机构",
      post: async function (data) {
        return await http.post(this.url, data);
      }
    },
    detail: {
      url: `${config.API_URL}/system/unit/get/`,
      name: "机构详情",
      get: async function (id) {
        return await http.get(`${this.url + id}`);
      }
    },
  },
  //岗位管理
  post: {
    list: {
      url: `${config.API_URL}/system/post/page`,
      name: "获取岗位列表",
      get: async function (data) {
        return await http.get(this.url, data);
      }
    },
    addPost: {
      url: `${config.API_URL}/system/post/add`,
      name: "添加岗位",
      post: async function (data) {
        return await http.post(this.url, data);
      }
    },
    updatePost: {
      url: `${config.API_URL}/system/post/update`,
      name: "修改岗位",
      post: async function (data) {
        return await http.post(this.url, data);
      }
    },
    delPost: {
      url: `${config.API_URL}/system/post/delete/`,
      name: "删除岗位",
      get: async function (id) {
        return await http.get(`${this.url + id}`);
      }
    },
    all:{
      url: `${config.API_URL}/system/post/all`,
      name: "全部岗位",
      get: async function (data) {
        return await http.get(this.url, data);
      }
    },
    detail: {
      url: `${config.API_URL}/system/post/get/`,
      name: "岗位详情",
      get: async function (id) {
        return await http.get(`${this.url + id}`);
      }
    },
  },
  //字典管理
  dict:{
    list: {
      url: `${config.API_URL}/system/dict/type/page`,
      name: "获取字典类型列表",
      get: async function (data) {
        return await http.get(this.url, data);
      }
    },
    addDict: {
      url: `${config.API_URL}/system/dict/type/add`,
      name: "添加字典",
      post: async function (data) {
        return await http.post(this.url, data);
      }
    },
    updateDict: {
      url: `${config.API_URL}/system/dict/type/update`,
      name: "修改字典",
      post: async function (data) {
        return await http.post(this.url, data);
      }
    },
    delDict: {
      url: `${config.API_URL}/system/dict/type/delete/`,
      name: "删除字典",
      get: async function (id) {
        return await http.get(`${this.url + id}`);
      }
    },
    detail: {
      url: `${config.API_URL}/system/dict/type/get/`,
      name: "字典类型详情",
      get: async function (id) {
        return await http.get(`${this.url + id}`);
      }
    },
  },
  //字典项
  dictItem:{
    list: {
      url: `${config.API_URL}/system/dict/item/page`,
      name: "获取字典项列表",
      get: async function (data) {
        return await http.get(this.url,data);
      }
    },
    addItem:{
      url: `${config.API_URL}/system/dict/item/add`,
      name: "添加字典项",
      post: async function (data) {
        return await http.post(this.url, data);
      }
    },
    delItem: {
      url: `${config.API_URL}/system/dict/item/delete/`,
      name: "删除字典项",
      get: async function (id) {
        return await http.get(`${this.url + id}`);
      }
    },
    updateItem: {
      url: `${config.API_URL}/system/dict/item/update`,
      name: "修改字典项",
      post: async function (data) {
        return await http.post(this.url, data);
      }
    },
    queryBatch: {
      url: `${config.API_URL}/system/dict/item/queryBatch`,
      name: "查询字典项（批量）",
      post: async function (data) {
        return await http.post(this.url, data);
      }
    },
    detail: {
      url: `${config.API_URL}/system/dict/item/get/`,
      name: "字典项详情",
      get: async function (id) {
        return await http.get(`${this.url + id}`);
      }
    },

  },
  //参数设置
  config:{
    page: {
      url: `${config.API_URL}/system/config/page`,
      name: "参数配置分页",
      get: async function (data) {
        return await http.get(this.url,data);
      }
    },
    add:{
      url: `${config.API_URL}/system/config/add`,
      name: "添加参数配置",
      post: async function (data) {
        return await http.post(this.url, data);
      }
    },
    del: {
      url: `${config.API_URL}/system/config/delete/`,
      name: "删除参数配置",
      get: async function (id) {
        return await http.get(`${this.url + id}`);
      }
    },
    update: {
      url: `${config.API_URL}/system/config/update`,
      name: "修改参数配置",
      post: async function (data) {
        return await http.post(this.url, data);
      }
    },
    detail: {
      url: `${config.API_URL}/system/config/get/`,
      name: "参数配置详情",
      get: async function (key) {
        return await http.get(`${this.url + key}`);
      }
    },
  },
  // 城市
    city: {
      url: `${config.API_URL}/system/area/getAreaByParentId`,
      name: "获取城市列表",
      get: async function (data) {
        return await http.get(this.url,data);
      }
    },
  //通知公告
  notice:{
    list:{
      url: `${config.API_URL}/system/notice/page`,
      name: "获取通知公告列表",
      get: async function (data) {
        return await http.get(this.url,data);
      }
    },
    delete:{
      url: `${config.API_URL}/system/notice/delete/`,
      name: "删除通知公告",
      get: async function (id) {
        return await http.get(this.url  + `${id}`);
      }
    },
    detail:{
      url: `${config.API_URL}/system/notice/get/`,
      name: "通知公告详情",
      get: async function (id) {
        return await http.get(this.url + `${id}`);
      }
    },
    add:{
      url: `${config.API_URL}/system/notice/add`,
      name: "添加通知公告",
      post: async function (data) {
        return await http.post(this.url, data);
      }
    },
    update:{
      url: `${config.API_URL}/system/notice/update`,
      name: "修改通知公告",
      post: async function (data) {
        return await http.post(this.url,data);
      }
    }
  },
  // 个人信息
  menu: {
    myMenus: {
      url: `${config.API_URL}/personal/getRouters/`,
      name: "获取菜单",
      get: async function (rolePerm) {
        return await http.get(this.url + `${rolePerm}`);
      },
    },
    list: {
      url: `${config.API_URL}/personal/getInfo`,
      name: "获取个人信息",
      get: async function () {
        return await http.get(this.url);
      },
    },
  },
  //用户管理
  userManagement:{
    list:{
      url: `${config.API_URL}/system/user/page`,
      name: "用户列表",
      get: async function (data) {
        return await http.get(this.url,data);
      }
    },
    delete:{
      url: `${config.API_URL}/system/user/delete/`,
      name: "删除用户",
      get: async function (id) {
        return await http.get(this.url + `${id}`);
      }
    },
    detail:{
      url: `${config.API_URL}/system/user/get`,
      name: "用户详情",
      get: async function (id) {
        return await http.get(this.url + '/' + `${id}`);
      }
    },
    add:{
      url: `${config.API_URL}/system/user/add`,
      name: "添加用户",
      post: async function (data) {
        return await http.post(this.url,data);
      }
    },
    update:{
      url: `${config.API_URL}/system/user/update`,
      name: "修改用户",
      post: async function (data) {
        return await http.post(this.url,data);
      }
    },
    checked:{
      url: `${config.API_URL}/system/user/checked/`,
      name: "用户选中角色",
      get: async function (id) {
        return await http.get(this.url + `${id}`);
      }
    },
    resetPassword:{
      url: `${config.API_URL}/system/user/reset/`,
      name: "重置密码",
      get: async function (id) {
        return await http.get(this.url + `${id}`);
      }
    },
    grant:{
      url: `${config.API_URL}/system/user/grant`,
      name: "授权用户",
      post: async function (data) {
        return await http.post(this.url,data);
      }
    }
  },

  //角色管理
  roles: {
    list: {
      url: `${config.API_URL}/system/role/page`,
      name: "角色列表",
      get: async function (params) {
        return await http.get(this.url, params);
      }
    },
    delete:{
      url: `${config.API_URL}/system/role/delete/`,
      name: "删除角色",
      get: async function (id) {
        return await http.get(this.url + `${id}`);
      }
    },
    add:{
      url: `${config.API_URL}/system/role/add`,
      name: "添加角色",
      post: async function (data) {
        return await http.post(this.url,data);
      }
    },
    update:{
      url: `${config.API_URL}/system/role/update`,
      name: "修改角色",
      post: async function (data) {
        return await http.post(this.url,data);
      }
    },
    detail:{
      url: `${config.API_URL}/system/role/get/`,
      name: "角色详情",
      get: async function (id) {
        return await http.get(this.url + `${id}`);
      }
    },
    all:{
      url: `${config.API_URL}/system/role/all`,
      name: "全部角色",
      get: async function (params) {
        return await http.get(this.url, params);
      }
    },
    assigned:{
      url: `${config.API_URL}/system/role/assigned`,
      name: "已授权用户",
      get: async function (params) {
        return await http.get(this.url, params);
      }
    },
    cancel:{
      url: `${config.API_URL}/system/role/cancel`,
      name: "取消授权用户",
      post: async function (data) {
        return await http.post(this.url,data);
      }
    }
  },

  //菜单管理
  menus:{
    list: {
      url: `${config.API_URL}/system/menu/page`,
      name: "获取菜单权限",
      get: async function (data) {
        return await http.get(this.url,data);
      },
    },
    delete:{
      url: `${config.API_URL}/system/menu/delete/`,
      name: "删除菜单权限",
      get: async function (id) {
        return await http.get(this.url + `${id}`);
      }
    },
    detail:{
      url: `${config.API_URL}/system/menu/get/`,
      name: "菜单详情",
      get: async function (id) {
        return await http.get(this.url + `${id}`);
      }
    },
    add:{
      url: `${config.API_URL}/system/menu/add`,
      name: "添加菜单权限",
      post: async function (data) {
        return await http.post(this.url,data);
      }
    },
    update:{
      url: `${config.API_URL}/system/menu/update`,
      name: "修改菜单权限",
      post: async function (data) {
        return await http.post(this.url,data);
      }
    },
    tree:{
      url: `${config.API_URL}/system/menu/tree`,
      name: "菜单权限树",
      get: async function () {
        return await http.get(this.url);
      }
    }
  },

  // ------------------------------------------------

  dic: {
    tree: {
      url: `${config.API_URL}/system/dic/tree`,
      name: "获取字典树",
      get: async function () {
        return await http.get(this.url);
      }
    },
    list: {
      url: `${config.API_URL}/system/dic/list`,
      name: "字典明细",
      get: async function (params) {
        return await http.get(this.url, params);
      }
    },
    get: {
      url: `${config.API_URL}/system/dic/get`,
      name: "获取字典数据",
      get: async function (params) {
        return await http.get(this.url, params);
      }
    }
  },
  role: {
    list: {
      url: `${config.API_URL}/system/role/list2`,
      name: "获取角色列表",
      get: async function (params) {
        return await http.get(this.url, params);
      }
    }
  },
  dept: {
    list: {
      url: `${config.API_URL}/system/dept/list`,
      name: "获取部门列表",
      get: async function (params) {
        return await http.get(this.url, params);
      }
    }
  },
  user: {
    list: {
      url: `${config.API_URL}/system/user/list`,
      name: "获取用户列表",
      get: async function (params) {
        return await http.get(this.url, params);
      }
    }
  },
  app: {
    list: {
      url: `${config.API_URL}/system/app/list`,
      name: "应用列表",
      get: async function () {
        return await http.get(this.url);
      }
    }
  },
  log: {
    list: {
      url: `${config.API_URL}/system/log/list`,
      name: "日志列表",
      get: async function (params) {
        return await http.get(this.url, params);
      }
    }
  },
  table: {
    list: {
      url: `${config.API_URL}/system/table/list`,
      name: "表格列管理列表",
      get: async function (params) {
        return await http.get(this.url, params);
      }
    },
    info: {
      url: `${config.API_URL}/system/table/info`,
      name: "表格列管理详情",
      get: async function (params) {
        return await http.get(this.url, params);
      }
    }
  },
  tasks: {
    list: {
      url: `${config.API_URL}/system/tasks/list`,
      name: "系统任务管理",
      get: async function (params) {
        return await http.get(this.url, params);
      }
    }
  }
}
